package com.tangfuzhong.test;

import com.tangfuzhong.bean.Person;
import com.tangfuzhong.config.Config02_1ComponentScan_Filter_FilterType_MyTypeFilter;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class IOCTest_02_1ComponentScan_Filter_FilterType_MyTypeFilter {
	
	@SuppressWarnings("resource")
	public static void main(String[] args) {


		//2. @Configuration取代了xml配置
		ApplicationContext applicationContext = new AnnotationConfigApplicationContext(Config02_1ComponentScan_Filter_FilterType_MyTypeFilter.class);
		Person bean = applicationContext.getBean(Person.class);
		System.out.println(bean);

		System.out.println("getBeanNamesForType:"+Person.class);
		String[] namesForType = applicationContext.getBeanNamesForType(Person.class);
		for (String name : namesForType) {
			System.out.println(name);
		}

		//所有的BeanDefinitionName
		System.out.println("getBeanDefinitionNames:");
		String[] definitionNames = applicationContext.getBeanDefinitionNames();
		for (String name : definitionNames) {
			System.out.println(name);
		}

	
	}

}
